
Array.prototype.unshift1=function(...unshiftEles){
    // 1. this.length 更新
    // 2. 向后移动
    // let newArray=unshiftEles.concat(this);
    let newArray=[...unshiftEles,...this];
    let length=newArray.length;
    let i=0;
    while(i<length){
        this[i]=newArray[i];
        i++
    }
    console.log(newArray);
    return length;
}

let arr=[2,3,4];
console.log(arr.unshift1(3));  // 新的数组长度
